﻿using System.Xml;

namespace Jayden.Dll.Sc2.Descriptions.Terran
{
	public class BuildingWithAddOnDescription : EntityDescription
	{
		private string m_AddOnId;
		private EntityDescription m_AddOn;

		public BuildingWithAddOnDescription(RaceDescription race, XmlNode entityNode)
			: base(race, entityNode)
		{
			m_AddOnId = entityNode.Attributes["addon"].Value;
		}

		public override string IconId { get { return Inherits.IconId; } }
		public override string Name { get { return string.Format("{0} with {1}", Inherits.Name, AddOn.Name); } }

		public EntityDescription AddOn
		{
			get
			{
				if (m_AddOn == null && m_AddOnId != null)
					m_AddOn = Race[m_AddOnId];
				return m_AddOn;
			}
		}
	}
}
